  
<cfcomponent displayname="lib" hint="I model a single lib.">

	<cfset variables.NumericNull = 0 />
	<cfset variables.StringNull = "" />
	<cfset variables.DateNull = now() />
	<cfset variables.BinaryNull = toBinary(toBase64("null")) />
		
	<cffunction name="init" access="public" returntype="lib" output="false" displayname="lib Constructor" hint="I initialize a lib.">
	<cfargument name="libid" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="name" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="description" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="parent" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="created" type="date" required="false" default="#variables.dateNull#"/>
	<cfargument name="updated" type="date" required="false" default="#variables.dateNull#"/>
	<cfargument name="isPublic" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="ownerID" type="string" required="false" default="#variables.stringNull#"/>
	

		<cfscript>
			variables.instanceData = structnew();
			
			setlibid(arguments.libid);
			setname(arguments.name);
			setdescription(arguments.description);
			setparent(arguments.parent);
			setcreated(arguments.created);
			setupdated(arguments.updated);
			setisPublic(arguments.isPublic);
			setownerID(arguments.ownerID);
		</cfscript>

		<cfreturn this />
	</cffunction>

	<cffunction name="setInstanceData" access="public" output="false" returntype="void">
		<cfargument name="data" type="struct" required="true"/>
		<cfset variables.instanceData = arguments.data/>
	</cffunction>

	<cffunction name="getInstanceData" access="public" output="false" returntype="struct">

		<cfreturn variables.instanceData/>
	</cffunction>
	
	<cffunction name="hasId" access="public" output="false" returntype="boolean" hint="I retrieve whether the lib has an id (false indicates it's a new user)">

		<cfreturn structKeyExists(variables.instanceData,"libID")/>
	</cffunction>

	
	<cffunction name="getlibid" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.libid />
	</cffunction>	

	<cffunction name="setlibid" access="public" returntype="void" output="false">
		<cfargument name="libid" type="numeric" required="true">
		<cfset variables.instanceData.libid=arguments.libid />
	</cffunction>
	
	<cffunction name="getname" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.name />
	</cffunction>	

	<cffunction name="setname" access="public" returntype="void" output="false">
		<cfargument name="name" type="string" required="true">
		<cfset variables.instanceData.name=arguments.name />
	</cffunction>
	
	<cffunction name="getdescription" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.description />
	</cffunction>	

	<cffunction name="setdescription" access="public" returntype="void" output="false">
		<cfargument name="description" type="string" required="true">
		<cfset variables.instanceData.description=arguments.description />
	</cffunction>
	
	<cffunction name="getparent" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.parent />
	</cffunction>	

	<cffunction name="setparent" access="public" returntype="void" output="false">
		<cfargument name="parent" type="numeric" required="true">
		<cfset variables.instanceData.parent=arguments.parent />
	</cffunction>
	
	<cffunction name="getcreated" access="public" returntype="date" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.created />
	</cffunction>	

	<cffunction name="setcreated" access="public" returntype="void" output="false">
		<cfargument name="created" type="date" required="true">
		<cfset variables.instanceData.created=arguments.created />
	</cffunction>
	
	<cffunction name="getupdated" access="public" returntype="date" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.updated />
	</cffunction>	

	<cffunction name="setupdated" access="public" returntype="void" output="false">
		<cfargument name="updated" type="date" required="true">
		<cfset variables.instanceData.updated=arguments.updated />
	</cffunction>
	
	<cffunction name="getisPublic" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.isPublic />
	</cffunction>	

	<cffunction name="setisPublic" access="public" returntype="void" output="false">
		<cfargument name="isPublic" type="numeric" required="true">
		<cfset variables.instanceData.isPublic=arguments.isPublic />
	</cffunction>
	
	<cffunction name="getownerID" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.ownerID />
	</cffunction>	

	<cffunction name="setownerID" access="public" returntype="void" output="false">
		<cfargument name="ownerID" type="string" required="true">
		<cfset variables.instanceData.ownerID=arguments.ownerID />
	</cffunction>
	
</cfcomponent>
	

